<h1>Listing products</h1>

<table>
  <thead>
    <tr class="list_line_even">
      <th>Photo</th>
      <th>Title</th>	
      <th>Price</th>
      <th>Actions</th>
      <th></th>
      <th></th>
    </tr>
  </thead>

  <tbody>
    <% @products.each do |product| %>
      <tr class="<%=  cycle('list_line_odd', 'list_line_even') %>">
      	<td><%= image_tag(product.image_url, class: 'list_image') %></td>
        <td class="list_description">
        	<dl>
        		<dt><%= product.title %></dt>
        		<dd><%= truncate(strip_tags(product.description), length: 80)%><dd>	
        	</dl>        		
        	</td>
        <td>
        	<%= product.price%>
        </td>
        <td class="list_actions">
        	<dl>
        		<dd><%= link_to 'Show', product %></dd>
        		<dd><%= link_to 'Edit', edit_product_path(product) %></dd>
        		<dd><%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %></dd>
        	</dl>
        </td>

      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Product', new_product_path %>
